package com.yfjin.gl.filter

import android.os.Bundle
import android.util.Log
import android.widget.CompoundButton
import android.widget.RadioGroup
import androidx.appcompat.app.AppCompatActivity
import com.yfjin.gl.R
import kotlinx.android.synthetic.main.activity_filter_demo.*

class FilterDemoActivity : AppCompatActivity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_filter_demo)

        btn_record?.setOnRecordListener(object : RecordButton.OnRecordListener {
            override fun onRecordStart() {
                cameraView.startRecord();
            }

            override fun onRecordStop() {
                Log.i("tuch", "onRecordStop: ----------------->");
                cameraView.stopRecord();
            }
        })
        //速度

        //速度
        rg_speed.setOnCheckedChangeListener(object : RadioGroup.OnCheckedChangeListener {
            override fun onCheckedChanged(group: RadioGroup?, checkedId: Int) {
                when (checkedId) {
                    R.id.btn_extra_slow -> cameraView.setSpeed(CamerView.Speed.MODE_EXTRA_SLOW)
                    R.id.btn_slow -> cameraView.setSpeed(CamerView.Speed.MODE_SLOW)
                    R.id.btn_normal -> cameraView.setSpeed(CamerView.Speed.MODE_NORMAL)
                    R.id.btn_fast -> cameraView.setSpeed(CamerView.Speed.MODE_FAST)
                    R.id.btn_extra_fast -> cameraView.setSpeed(CamerView.Speed.MODE_EXTRA_FAST)
                }
            }
        })



        beauty_check.setOnCheckedChangeListener(object : CompoundButton.OnCheckedChangeListener {
            override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
                cameraView.enableBeaty(isChecked)
            }
        })
    }
}